package fcc.Seng462project.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;

/*
  *UI popup dialog contain: one textbox, two buttons
*put other user name into textbox
*/
public class shareDialog extends DialogBox{
	public final Button confirmButton=new Button("Confirm");
	public final Button cancelButton=new Button("Cancel");
	public final TextBox nameBox=new TextBox();
	public final FlexTable layout=new FlexTable();
	public final Label nameLabel=new Label("Sharing with");
	
	public shareDialog(){
		
		layout.setWidget(0, 0, nameLabel);
		layout.setWidget(0, 1, nameBox);
		
		
		
		layout.setWidget(1,1,cancelButton);
		layout.setWidget(1,2,confirmButton);
		
		
		layout.getFlexCellFormatter().setColSpan(0, 1, 2);
		layout.getFlexCellFormatter().setColSpan(1, 1, 2);
		
		setWidget(layout);
		/*Cancel button actionLinster to hide the shareDialog*/
		cancelButton.addClickHandler(new ClickHandler(){
			public void onClick(ClickEvent event){
				Cancel();
			}
		});
		
	}
	/*reset the textbox*/
	public void Cancel(){
		nameBox.setText("");
		hide();
	}
}

